package com.ssy.lingxi.platform.manage.controller;

import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.manage.api.model.dto.parameter.ParameterManageUpdateDTO;
import com.ssy.lingxi.platform.manage.api.model.dto.parameter.ParameterManageUpdateStateDTO;
import com.ssy.lingxi.platform.manage.api.model.vo.parameter.ParameterManagePageVO;
import com.ssy.lingxi.platform.manage.service.PlatformParameterManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @menu 平台后台 - 系统管理
 * @author wrc, yzc
 * @date 2020/10/22
 */
@Api(tags = "平台后台 - 系统管理")
@RestController
@RequestMapping("/manage")
public class PlatformParameterManageController {

    @Resource
    private PlatformParameterManageService platformParameterManageService;

    /**
     * 系统管理-平台参数管理分页列表
     */
    @ApiOperation(value = "系统管理-平台参数管理分页列表")
    @GetMapping("/parameter/manage/page")
    public Wrapper<PageData<ParameterManagePageVO>> parameterManagePage(PageVO request) {
        return platformParameterManageService.parameterManagePage(request);
    }

    /**
     * 系统管理-平台参数配置修改
     */
    @ApiOperation(value = "系统管理-平台参数配置修改")
    @PostMapping("/parameter/manage/update")
    public Wrapper<Void> parameterManageUpdate(@RequestBody @Validated ParameterManageUpdateDTO request) {
        return platformParameterManageService.parameterManageUpdate(request);
    }

    /**
     * 系统管理-平台参数配置停用/启用
     */
    @ApiOperation(value = "系统管理-平台参数配置停用/启用")
    @PostMapping("/parameter/manage/update/state")
    public Wrapper<Void> parameterManageUpdateState(@RequestBody @Validated ParameterManageUpdateStateDTO request) {
        return platformParameterManageService.parameterManageUpdateState(request);
    }
}
